{% extends 'base.html'%}

{% block content %}

<h1>欢迎使用基于深度学习的酒店评论情感分析系统</h1>
<!--<p>{{resultString}}</p>-->
<div class="container">
    <center style="padding-top:10vh">
        <ul class="nav nav-tabs" id="myTab" role="tablist">
            <li class="nav-item">
                <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home"
                   aria-selected="true">语句分析</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab"
                   aria-controls="profile"
                   aria-selected="false">文件分析</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab"
                   aria-controls="contact"
                   aria-selected="false">爬虫分析</a>
            </li>
        </ul>
        <div class="tab-content" id="myTabContent">
            <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">

                <form class="input-group mb-3" method="POST" action="{% url 'analysis' %}">
                    {% csrf_token %}
                    <input type="text" class="form-control" name="inputString" placeholder="请输入分析的语句"
                           aria-label="请输入分析的语句" aria-describedby="button-addon2">
                    <div class="input-group-append">
                        <button class="btn btn-outline-secondary" type="submit" id="button-addon2">分析</button>
                    </div>
                </form>

            </div>
            <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">

                <form class="input-group" enctype="multipart/form-data" method="POST" action="{% url 'file' %}">
                    {% csrf_token %}
                    <div class="custom-file">
                        <input type="file" class="custom-file-input" id="inputGroupFile04"
                               aria-describedby="inputGroupFileAddon04" name="userfile">
                        <label class="custom-file-label" for="inputGroupFile04">选择文件（支持csv、json、txt格式）</label>
                    </div>
                    <div class="input-group-append">
                        <button class="btn btn-outline-secondary" type="submit" id="inputGroupFileAddon04"
                                value="upload">分析
                        </button>
                    </div>
                </form>

            </div>

            <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">

                <form class="input-group mb-3" method="GET" action="{% url 'crawl' %}">
                    {% csrf_token %}
                    <div class="input-group mb-3">
                        <div class="input-group-prepend">
                            <span class="input-group-text">城市名称</span>
                        </div>
                        <input type="text" class="form-control" aria-label="Sizing example input"
                               aria-describedby="inputGroup-sizing-default" name="city" placeholder="请输入所爬取酒店的所在城市">
                    </div>

                    <div class="input-group mb-3">
                        <div class="input-group-prepend">
                            <span class="input-group-text">酒店ID</span>
                        </div>
                        <input type="text" class="form-control" aria-label="Sizing example input"
                               aria-describedby="inputGroup-sizing-default" name="hotelId"  placeholder="请输入所爬取酒店的ID">
                    </div>

                    <div class="input-group mb-3">
                        <div class="input-group-prepend">
                            <label class="input-group-text" for="inputGroupSelect01">爬取页数</label>
                        </div>
                        <select class="custom-select" id="inputGroupSelect01" name="pageNum">
                            <option value="1" selected>One</option>
                            <option value="2">Two</option>
                        </select>
                    </div>

                    <div class="container">
                            <div class="col align-self-center">
                                <button type="submit" class="btn btn-outline-info">爬取</button>
                            </div>
                    </div>


                </form>


            </div>


        </div>
    </center>


    <!--    <div class="row" style="margin-top: 300px">-->
    <!--        {% for x in api %}-->
    <!--        <div class="col-sm">-->
    <!--            <div class="card" style="width: 18rem;">-->
    <!--                <img src="{{x.avatar_url}}" class="card-img-top" alt="...">-->
    <!--                <div class="card-body">-->
    <!--                    <h5 class="card-title">{{x.login}}</h5>-->
    <!--                    <p class="card-text">{{x.login}}的github</p>-->
    <!--                    <a href="{{x.html_url}}" class="btn btn-primary">访问</a>-->
    <!--                </div>-->
    <!--            </div>-->
    <!--        </div>-->
    <!--        <br>-->
    <!--        {% endfor %}-->
    <!--    </div>-->
</div>

{% endblock %}



